<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>jquery选项卡</title>
	<style type="text/css">
		.btns{
			width: 500px;
			height: 50px;
		}

		.btns input{
			width: 100px;
			height: 50px;
			background-color: #ddd;
			color: #666;
			border: 0px;
		}

		.btns input .cur{
			background-color: cyan;
		}

		.contents div{
			width: 500px;
			height: 300px;
			background-color: gold;
			display: none;
			line-height: 300px;
			text-align: center;
		}
	
		.contents div.active{
			display: block;
		}
	</style>
	<script type="text/javascript" src="../js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript">
		$(function(){
			$('#btns input').click(function(){

				$(this).blur(); //消除焦点
				alert($(this).index());
			
				$(this).addClass('cur').siblings().removeClass('cur');

				// $(this).index() 获取所在层级索引值
				// alert($(this).index());

				$('#contents div').eq($(this).index()).addClass('active').siblings().removeClass('active');
			});
		})
	</script>
</head>
<body>
	<div class="btns" id="btns">
		<input type="button" value="tab01" class="cur">
		<input type="button" value="tab02">
		<input type="button" value="tab03">
	</div>
	<div class="contents" id="contents">
		<div class="active">tab文字内容1</div>
		<div>tab文字内容2</div>
		<div>tab文字内容3</div>
	</div>
</body>
</html>